package org.scirp.ijmis.dao.journal.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.scirp.ijmis.dao.base.impl.BaseDAOImpl;
import org.scirp.ijmis.dao.journal.IEmailServerDAO;
import org.scirp.ijmis.po.journal.EmailServer;

public class EmailServerDAOImpl extends BaseDAOImpl<EmailServer> implements IEmailServerDAO {

	private static final String className = EmailServerDAOImpl.class.toString();

	public List<EmailServer> selectAll() {

		String hql = "from EmailServer order by pid desc";
		return super.ExecuteQuery(hql, className + "-->selectAll");
	}

	public EmailServer selectById(long id) {

		return (EmailServer) super.selectById(id, className + "-->selectById");
	}

	public EmailServer deleteEmailServer(EmailServer emailServer) {
		return super.deleteObject(emailServer, className + "-->deleteEmailServer");
	}

	public long saveEmailServer(EmailServer emailServer) {
		return super.saveObject(emailServer, className + "-->saveEmailServer");
	}

	public boolean updateEmailServer(EmailServer emailServer) {
		return super.updateObject(emailServer, className + "-->updateEmailServer");
	}

	public EmailServer selectByJournalId(Long journalId) {
		String hql = "from EmailServer where journal.pid=:journalId order by pid desc";

		Map parameters = new HashMap();
		parameters.put("journalId", journalId);

		return (EmailServer) super.selectSingle(hql, parameters, className + "-->selectByJournalId");
	}
}
